Compare all baselines from a module

I find myself in some complicated situation. 
I don't know where to begin. 
What I'm trying to do, is modify the dxl provided by the IBM, the baseline.dxl which is in the 'example' and make this script not only compare two selected baselines, but all the baselines from an module. 
And that is my problem, I'm not sure how to start doing this. 
Has anyone done something like this? 
Or have any suggestions on how to proceed. 
Thank you.

braolive - Thu Aug 14 16:17:29 EDT 2014

Re: Compare all baselines from a module
llandale - Thu Aug 21 12:18:16 EDT 2014

You want to compare the 1st one to the current?  Or the 1st one to the 2nd one, then the 2nd one to the 3rd one, ..., last baseline to the current?  Assuming the 2nd....

I don't think you can have a baseline loop inside a baseline loop for the same module.  So you want to store the "Baseline"s in a skip list in the correct order.  Then parse the Skip List.  Something like this:

  • Skip skpBaselines = create()   // KEY 'int' Secuqence, DATA: 'Baseline'
  • int Sequence = 0
  • for b in m do { put(skpBaselines, Sequence++, b) }    // Note: 1st baseline has sequence zero
  • void  DoCompare(int SequenceDesired)
  • {   bFrom = find(skpBaselines, SequenceDesired)
  •     bTo      = find(skpBaselines, SequenceDesired +1)
  •     if (null bTo) then use the "Current" module
  •      now compare (bFrom to bTo)
  • }
  • for (i=0; i<Sequence; i++) {DoCompare(i)}

-Louie

Re: Compare all baselines from a module
Chris Annal - Fri Aug 29 11:01:33 EDT 2014

I know this script was posted somewhere else in this forum. (It might have been Matthias). I'm just sharing it here because I copied it from wherever it was posted and just put some comments in. It will display all the modifications from every baseline of the module in a Layout DXL column. All you should have to do is change the date in the line..."Date modificationDate = "08/03/06 00:00:00"...to whatever date you want to go back to in your comparison. I generally use it for the date of the 2nd baseline of a module, since the first baseline (in my experience) has a LOT of changes as the requirements are hashed out. Also, if the module opens slowly with this DXL Layout column in a view, consider converting it to attribute DXL so it doesn't have to look through every baseline to populate that column every time you view it. Another option would be to export it to Excel, then create a text attribute to contain this information and import it back into that attribute. That way, you can run scripts to apply formatting to the text, such as "bold" to every instance of "NEW" or "OLD", to make that information stand out.

 

//Show ModificationsFromAllBaselines
/*
Written in DOORS 9.3.0.7, but should work in previous versions
This script will display in a Layout DXL column the
Baseline History of each object. It will display the Baseline number
and date. For Objects where the text changed between baselines, it shows both the
old value and the new value of changed objects.
*/
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Baseline B
Module m
 
Date modificationDate = "08/03/06 00:00:00"
Object searchObj = obj
Buffer b1 = create
Buffer b2 = create
Skip sk = create()
Date D
 
int count = 0
// Use a skip list to sort the baselines in reverse order
for B in current Module do put (sk, count--, B);
 
// put a dummy item to the skip list, so we can use the same
// loop for current module and baselines. Put it after the last one

put (sk, count , null Baseline)
 
// iterate through the baselines
for B in sk do {
    if (!null B) {
                // check if the baseline was done before the modification date
                // -> no interesting history could be in there

                D = dateAndTime dateOf B
                if (D < modificationDate) break
 
                // load the baseline
               // print "Scanning baseline: " (major B) "." (minor B) (suffix B) "  -->  " D "\n"

                m = load(B, false)
        } else {
                // load the current module
                     m = current Module
        }
 
        // find the object in the baseline by absolute number
        int searchNr = searchObj."Absolute Number"
 
        // first search the object using the fast object function
        // won't work for non visible objects, use a 'for obj in entire m'
        // loop to maybe find the object if it is null

        Object targetObj = object(searchNr, m)
 
        // if the object did not exist in the baseline then do nothing 
        if (null targetObj) { display "Object did not exist in baseline: " (major B) "." (minor B)"." (suffix B)
; halt }
 
        History h
        // scan the object history in the baseline
        if (!null targetObj) {
        for h in targetObj do {
                Date historyDate = h.date
                if (historyDate > modificationDate) {
                       if ((h.type == modifyObject) && (h.attrName == "Object Text")) {
                        if (!null B) {
                         Buffer b1 = h.oldValue
                         Buffer b2 = h.newValue
                        
          displayRich ("Module Baseline: " (major B) "."(minor B)"."(suffix B)", text change dated " h.date "\nOLD : " h.plainOldValue "\n" "NEW : " h.plainNewValue"\n")
             }
                          }  
             }
              }
 
       }
    }
delete sk